Packet processing on a multi-core processor

ABSTRACT

A method for packet processing on a multi-core processor. According to one embodiment of the invention, a first set of one or more processing cores are configured to include the capability to process packets belonging to a first set of one or more packet types, and a second set of one or more processing cores are configured to include the capability to process packets belonging to a second set of one or more packet types, where the second set of packet types is a subset of the first set of packet types. Packets belonging to the first set of packet types are processed at a processing core of either the first or second set of processing cores. Packets belonging to the second set of packet types are processed at a processing core of the first set of processing cores.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application is a continuation and claims the prioritybenefit of U.S. patent application Ser. No. 14/818,218 filed Aug. 4,2015, now U.S. Pat. No. 9,535,773 that issued on Jan. 3, 2017, which isa continuation and claims the priority benefit of U.S. patentapplication Ser. No. 14/079,308 filed Nov. 13, 2013, now U.S. Pat. No.9,098,330 that issued on Aug. 4, 2015, which is a continuation andclaims the priority benefit of U.S. patent application Ser. No.13/196,454 filed Aug. 2, 2011, now U.S. Pat. No. 8,594,131 that issuedon Nov. 26, 2013, which is a continuation claims the priority benefit ofU.S. patent application Ser. No. 12/240,892 filed Sep. 29, 2008, nowU.S. Pat. No. 7,990,974 that issued on Aug. 2, 2011, the disclosures ofwhich are incorporated herein by reference.

BACKGROUND OF THE INVENTION

Field of the Invention

Embodiments of the invention relate to the field of packet processing;and more specifically, to packet processing on a multi-core processor.

Description of the Related Art

A multi-core processor (e.g., a multi-core network processor, amulti-core general purpose processor, etc.) is a processor with two ormore processing cores. Multi-core processors may increase processingperformance. However, the packet processing architecture of a system ismodified to realize the processing performance advantages of amulti-core processor. One packet processing architecture includesexecuting the same packet processing modules on each core. Thus, in thispacket processing architecture, each core may process any packet.

Another packet processing architecture includes a single processing coreor processor (e.g., a separate general purpose CPU) only processing“exception” packets, while the other cores only process “non-exception”packets. In this architecture, typically all packets are received by theprocessing cores that process the “non-exception” packets. Upondetermining a packet is an “exception” packet, that packet is forwardedto the processing core or processor dedicated for processing “exception”packets.

BRIEF DESCRIPTION OF THE DRAWINGS

The invention may best be understood by referring to the followingdescription and accompanying drawings that are used to illustrateembodiments of the invention. In the drawings:

FIG. 1 is a block diagram illustrating an exemplary packet processingarchitecture on a multi-core processor according to one embodiment ofthe invention;

FIG. 2 is a data flow diagram illustrating an exemplary packetprocessing architecture on a multi-core processor having two processingcores according to one embodiment of the invention;

FIG. 3 is a data flow diagram illustrating an exemplary packetprocessing architecture on a multi-core processor having two or moreprocessing cores according to one embodiment of the invention;

FIG. 4 is a flow diagram illustrating operations of an exemplarymulti-core packet processing architecture according to one embodiment ofthe invention;

FIG. 5 is a conceptual flow diagram illustrating an exemplary processingphases of a packet being executed according to one embodiment of theinvention;

FIG. 6 is a data flow diagram illustrating scheduling and de-schedulingpacket processing to cores of a multi-core processor according to oneembodiment of the invention; and

FIG. 7 is a flow diagram illustrating operations for de-schedulingpacket processing to prevent head of the line blocking according to oneembodiment of the invention.

DETAILED DESCRIPTION

In the following description, numerous specific details are set forth.However, it is understood that embodiments of the invention may bepracticed without these specific details. In other instances, well-knowncircuits, structures and techniques have not been shown in detail inorder not to obscure the understanding of this description. Those ofordinary skill in the art, with the included descriptions, will be ableto implement appropriate functionality without undue experimentation.

References in the specification to “one embodiment”, “an embodiment”,“an example embodiment”, etc., indicate that the embodiment describedmay include a particular feature, structure, or characteristic, butevery embodiment may not necessarily include the particular feature,structure, or characteristic. Moreover, such phrases are not necessarilyreferring to the same embodiment. Further, when a particular feature,structure, or characteristic is described in connection with anembodiment, it is submitted that it is within the knowledge of oneskilled in the art to effect such feature, structure, or characteristicin connection with other embodiments whether or not explicitlydescribed.

In the following description and claims, the terms “coupled” and“connected,” along with their derivatives, may be used. It should beunderstood that these terms are not intended as synonyms for each other.“Coupled” is used to indicate that two or more elements, which may ormay not be in direct physical or electrical contact with each other,co-operate or interact with each other. “Connected” is used to indicatethe establishment of communication between two or more elements that arecoupled with each other.

The techniques shown in the figures can be implemented using code anddata stored and executed on one or more electronic devices (e.g., acomputer end station, a network element, etc.). Such electronic devicesstore and communicate (internally and with other electronic devices overa network) code and data using machine-readable media, such as machinestorage media (e.g., magnetic disks; optical disks; random accessmemory; read only memory; flash memory devices; phase-change memory) andmachine communication media (e.g., electrical, optical, acoustical orother form of propagated signals—such as carrier waves, infraredsignals, digital signals, etc.). In addition, such electronic devicestypically include a set of one or more processors coupled to one or moreother components, such as a storage device, one or more userinput/output devices (e.g., a keyboard, a touchscreen, and/or adisplay), and a network connection. The coupling of the set ofprocessors and other components is typically through one or more bussesand bridges (also termed as bus controllers). The storage device andsignals carrying the network traffic respectively represent one or moremachine storage media and machine communication media. Thus, the storagedevice of a given electronic device typically stores code and/or datafor execution on the set of one or more processors of that electronicdevice. Of course, one or more parts of an embodiment of the inventionmay be implemented using different combinations of software, firmware,and/or hardware.

As used herein, a network element (e.g., a router, switch, bridge,secure router, unified threat management (UTM) appliance (e.g.,including functionality including but not limited to firewall, gateway,anti-virus, anti-spyware, intrusion detection system, intrusionprevention system, web content filtering, and/or IPsec VPN) is a pieceof networking equipment, including hardware and software thatcommunicatively interconnects other equipment on the network (e.g.,other network elements, computer end stations, etc.). A secure routerincludes, but is not limited to, routing functionality, switchingfunctionality and security functionality (e.g., firewall, gateway,anti-virus, anti-spyware, intrusion detection system, intrusionprevention system, web content filtering, and/or IPsec VPN, userauthentication, client security posture assessment, etc.).

A method and apparatus for packet processing on a multi-core processoris described. In one embodiment of the invention, a first set of one ormore processing cores are loaded with packet processing modules thatinclude the capability of processing packets belonging to a first set ofone or more packet types, and a second set of one or more processingcores are loaded with packet processing modules that include thecapability of processing packets belonging to a second set of one ormore packet types, the second set of packet types being a subset of thefirst set of packet types.

According to one embodiment of the invention, the first set of packettypes includes each packet to be processed by the multi-core processor.For example, each ingress packet (including control packets, datapackets, packets relating to configuration, etc.) may be processed bythe first set of one or more processing cores. The second set of packettypes is a subset of the first set of packet types. For example, thesecond set of one or more processing cores is capable of processing asubset of the ingress packets (e.g., data packets). According to oneembodiment of the invention, the second set of packet types includessubstantially all ingress packets.

In one embodiment of the invention, each processing core may be assignedany packet regardless of the packet processing capabilities included onthe processing cores. If a processing core does not include thecapability of processing a particular packet, that packet is redirectedto a processing core that includes the capability to process thatpacket. In an alternative embodiment of the invention, processing coresare assigned packets to process based on their processing capabilities.

In one embodiment of the invention, a packet goes through variousprocessing stages during its processing lifecycle. Each processing stageis identifiable with a processing stage identification. Certainprocessing stages and/or portions of processing stages require locks tobe placed on certain packet flows. For example, if the processingresults of a certain stage or received packet needs to be consumed by asubsequent stage or a subsequently received packet, that subsequentstage or subsequently received packet is stalled. If a processing coreencounters a lock, the processing core may de-schedule the packet andreceive a different packet to process. After the lock is removed, thepreviously de-scheduled packet is assigned to a core for processing.

FIG. 1 is a block diagram illustrating an exemplary packet processingarchitecture on a multi-core processor according to one embodiment ofthe invention. The multi-core processor 100 is included in a securerouter according to one embodiment of the invention. The multi-coreprocessor 100 includes N cores. The multi-core processor 100 includesthe processing cores 110A-110N, and the packet work assignment unit 105.Other well-known features of multi-core processors are not shown inorder not to confuse understanding of the invention (e.g., memory(ies),bus(es), gate(s), etc.). While the packet work assignment unit 105 isillustrated as being included within the multi-core processor 100, otherembodiments of the invention have the packet work assignment unit 105being included outside of the multi-core processor 100.

The complete firmware 130 is loaded onto the processing core 110A (e.g.,the processing core 110A executes the complete firmware 130). Accordingto one embodiment of the invention, the complete firmware 130 includesthe same processing capabilities as if the processing core 110A was theonly processing core available on the multi-core processor 100,including operating system support. For example, the code base for asingle core network element may be substantially similar to the completefirmware 130, which minimizes modifications to an existing code base.The subset firmware 140A-140N is loaded onto the processing cores110B-110N respectively. The subset firmware 140A-140N is a subset of thefeatures and processing capability of the complete firmware 130.According to one embodiment of the invention, the subset firmware140A-140N does not include operating system functionality. Thus, theamount of code loaded onto each of the processing cores 110B-110N istypically less than the amount of code loaded on to the processing core110A. According to one embodiment of the invention, the completefirmware 130 may process each packet that the subset firmware 140A-140Nmay process, and additional packets and configuration managementmessages that the subset firmware 140A-140N cannot process.

The packet work assignment unit 105 assigns (schedules) work for theprocessing cores 110A-110N. The packet work assignment unit 105 mayassign packets by a number of mechanisms. For example, the packet workassignment unit 105 may include one or more ingress packet buffers(e.g., ingress queue(s)) and assign packets to be processed to theprocessing cores 110A-110N based on the availability of the processingcores, and based on the order of receipt of the incoming packets. In oneembodiment of the invention the processing cores 110A-110N request workfrom the packet work assignment unit 105 when they are available (e.g.,not processing a packet), while in an alternative embodiment of theinvention the packet work assignment unit 105 polls the processing cores110A-110N to determine the availability of the processing cores110A-110N.

In one embodiment of the invention, the packet work assignment unit 105separates packets into one or more flows, depending on characteristicsof the packet (e.g., source IP address, destination IP address, sourceport, destination port, protocol, etc.). According to one embodiment ofthe invention, a particular flow may be assigned to a particularprocessing core (e.g., all packets from that flow may be assigned tothat processing core), while in an alternative embodiment of theinvention packets from the same flow may be assigned to differentprocessing cores.

FIG. 2 is a data flow diagram illustrating an exemplary packetprocessing architecture on a multi-core processor having two processingcores according to one embodiment of the invention. The multi-coreprocessor 200 includes two processing cores, the processing core 210 andthe processing core 220, and the packet work assignment unit 205.Similarly as described with reference to FIG. 1, other well-knownfeatures of multi-core processors are not illustrated in order not toconfuse understanding of the invention (e.g., memory(ies), bus(es),gate(s), etc.). While the packet work assignment unit 205 is illustratedas being included within the multi-core processor 200, other embodimentsof the invention have the packet work assignment unit 205 being includedoutside of the multi-core processor 200. According to one embodiment ofthe invention, the multi-core processor 200 is included in a securerouter.

The firmware 215 is loaded onto the processing core 210 and the firmware225 is loaded onto the processing core 220. According to one embodimentof the invention, the firmware 215 includes a complete operating systemthat includes the functionality to process all ingress packets(including control packets, data packets, configuration packets, etc.)and the firmware 225 includes a subset of the features of the firmware215. However, it should be understood that in alternative embodiments ofthe invention the firmware 215 does not include a complete operatingsystem and may not include the functionality to process all ingresspackets. The firmware 215 includes the processing type determinationmodule 240, one or more non-network packet processing modules 230, andone or more network packet processing modules 250. The processing typedetermination module 240 parses work and determines the appropriateprocessing module to process that work. The one or more non-networkpacket processing modules 230 are used to process non-network packets(e.g., packets relating to configuration management, etc.). The one ormore network packet processing module(s) 250 are used to process eachingress network packet (e.g., data packets, control packets, etc.).According to one embodiment of the invention, the non-network packetprocessing module(s) 230 and the network packet processing module(s) 250together define the types of packets the firmware 215 supportsprocessing. Packets belonging to the non-network packet processingmodule(s) 230 and/or the network packet processing module(s) 250 arepackets that may be processed by the non-network packet processingmodule(s) and/or the network packet processing module(s) 250.

According to one embodiment of the invention, the firmware 225 includesa subset of the features of the firmware 215. The firmware 225 includesthe processing type determination module 260 and one or more subsetnetwork packet processing modules 270. The network packet processingmodule(s) 270 is a subset of the network packet processing module(s)250. For example, the network packet processing module(s) 270 cannotprocess each packet that the network packet processing module(s) 250 mayprocess. According to one embodiment of the invention, control packetsmay be processed by the network packet processing module(s) 250 andcannot be processed by the subset network packet processing module(s)270. While in one embodiment of the invention the firmware 225 includessupport for processing packets requiring operating system support, in analternative embodiment of the invention the firmware 225 does notinclude support for processing packets that require operating systemsupport. According to one embodiment of the invention, the subsetnetwork packet processing module(s) 270 define the types of packets thefirmware 225 supports processing. Packets belonging to the subsetnetwork packet processing module(s) 270 are packets that may beprocessed by the subset network packet processing module(s) 270.

According to one embodiment of the invention, the network packetprocessing module(s) 270 includes support for processing substantiallymost packets (i.e., most of the packets to be processed by themulti-core processor 200 are capable of being processed by the subsetnetwork packet processing module(s) 270). Packets that cannot beprocessed by the subset network packet processing module(s) 270 may beredirected to the processing core 210 (these packets may be referred toas “exception” packets). According to one embodiment of the invention,the processing type determination module 260 determines whether thesubset network packet processing module(s) 270 is capable of processingan incoming packet, and if so, which of the subset network packetprocessing module(s) can process that packet. For example, theprocessing type determination module 260 determines the type of thepacket, and whether processing that type of packet is supported by oneor more of the subset network packet processing module(s) 270.

In one embodiment of the invention, the majority of network packets(e.g., “non-exception” packets such as certain data packets, etc.) maybe processed by either the processing core 210 or the processing core220. In other words, the processing core 210 and the processing core 220may each process the majority of packets. However, for the minority ofnetwork packets (e.g., “exception” packets such as certain controlpackets, configuration packets, etc.), only the processing core 210 iscapable of processing those packets.

This multi-core packet processing architecture increases throughput,efficiency, is scalable with two or more processing cores, and reducesthe amount of code base required for packet processing. For example, ina typical “slow path” architecture, which has a set of one or moreprocessing cores being dedicated for processing only “exception”packets, those processing cores are idle when not processing “exception”packets. By way of example, in previous multi-core processingarchitectures, if the multi-core processor has two processing cores, onebeing dedicated for processing “exception” packets and the other beingdedicated for processing “non-exception” packets, it should beunderstood that the processing core dedicated for processing “exception”packets remains idle most of the time (“exception” packets areencountered much less frequently than “non-exception” packets). Incontrast, embodiments of the invention include a first set of one ormore processing cores capable of processing “exception” packets and“non-exception” packets (e.g., all packets), and a second set of one ormore processing cores capable of processing “non-exception” packets(e.g., the majority of packets). Thus, embodiments of the inventionreduce the amount of time any of the processing cores of a multi-coreprocessor are idle, which increases packet processing throughput andefficiency.

In addition, unlike other multi-core packet processing architectureswhich load the same packet processing capability on each processing core(which increases the code base and complexity of the architecture),embodiments of the invention allow for a reduced code size. For example,in some embodiments of the invention only a single processing core isloaded with a complete firmware (e.g., including an operating systemthat is capable of processing configuration management, data packets,control packets, etc.) while the other processing cores are loaded witha certain subset of that firmware to process the majority of the packetsthat the multi-core processor will encounter. Of course it should beunderstood that in alternative embodiments of the invention more thanone processing core is loaded with a complete firmware.

Referring back to FIG. 2, at operation 1, the packet 208 enters thepacket work assignment unit 205. For example, the packet 208 wasreceived by an interface into the network element and stored in memoryand a reference to that packet was placed into an ingress queueassociated with the packet work assignment unit 205. According to oneembodiment of the invention, the packet work assignment unit 205 assignswork to the processing cores 210 and 220 based on their availabilitywithout regard to their individual packet processing capability (e.g.,without regard to whether they are loaded with the appropriate packetprocessing module to process that packet). However, it should beunderstood that in an alternative embodiment of the invention, thepacket work assignment unit 205 assigns work to the processing cores 210and 220 differently (e.g., based on their availability and/or based inrespect to their individual packet processing capability, round-robin,etc.). For purposes of the following description, the packet workassignment unit 205, as illustrated in FIG. 2, determines to assign workto the processing cores 210 and 220 based on their processingavailability. Thus, either processing core 210 or 220 may be assigned toprocess the packet 208 regardless of whether the processing cores 210 or220 are loaded with the processing module(s) to process the packet 208.Therefore, the operations 2-5 describe the operations performed when thepacket work assignment unit 205 assigns the packet 208 to be processedby the processing core 220, and the operations 6 and 7 describe theoperations performed when the packet work assignment unit 205 assignsthe packet 208 to be processed by the processing core 210.

At operation 2, the packet work assignment unit 205 assigns the packet208 to be processed by the processing core 220. The packet workassignment unit 205 may assign the packet 208 in any number of ways,including causing a reference to be inserted into a work queue of theprocessing core 220, causing the packet 208 to be read into a memory ofthe processing core 220, etc. At operation 3, the processing typedetermination module 260 determines the type of the packet 208 andwhether the firmware 225 (loaded on the processing core 220) is capableof processing the packet 208 (e.g., whether the packet 208 belongs tothe subset network packet processing module(s) 270). There are many waysthe processing type determination module 260 determines whether thefirmware 225 has the functionality to process the packet 208. Forexample, in one embodiment of the invention, the processing typedetermination module 206 determines the type of the packet 208 (e.g.,whether the packet is a data packet, a control packet, a packet relatedto configuration, etc.) and whether the subset network packet processingmodule(s) 270 includes one or more modules necessary to process thepacket 208. According to one embodiment of the invention, the processingtype determination module 206 determines the type of packet 208 from theheader of the packet. In an alternative embodiment of the invention, thepacket work assignment unit associates each work item with a processingphase identifier which the processing type determination module 260 mayuse when determining whether the firmware 225 has the functionality toprocess that packet.

If the processing type determination module 260 determines that thepacket 208 belongs to the subset network packet processing module(s) 270and thus may be processed by the firmware 225, at operation 4A thepacket is processed with the appropriate module. Thus, in operation 4A,the packet 208 is determined to be a “non-exception” packet and isprocessed by one or more of the subset network packet processingmodule(s) 270.

If the processing type determination module 260 determines that thepacket 208 does not belong to the subset network packet processingmodule(s) 270 and thus cannot be processed by the firmware 225, atoperation 4B the packet is redirected to the core 210. Thus, inoperation 4B, the packet 208 is determined to be an “exception” packetwhich cannot be processed by the firmware 225. The packet may beredirected in any number of ways. For example, the packet 208 may bereturned to the packet work assignment unit 205, which may then placethe packet into a specialized queue for the processing core 210. Thus,when the processing core 210 is available for work, the packet workassignment unit 205 assigns the packet 208 to the processing core 210.Of course, other redirection mechanisms may be used in embodiments ofthe invention described herein. Sometime later, after being assigned thepacket 208 which has been redirected, at operation 5, the firmware 215processes the packet 208 with the appropriate packet processing module(e.g., one or more of the non-network packet processing module(s) 230and network packet processing module(s) 250).

At operation 6, the packet work assignment unit 205 assigns the packet208 to be processed by the processing core 210. Since the firmware 215includes a complete operating system capable of processing any ingresspacket, the processing type determination module 240 determines whichpacket processing module(s) are used to process packets of that type(e.g., whether the packet is a non-network packet (e.g., related toconfiguration management) or a network packet), and at operation 7, thatpacket is processed with the appropriate packet processing module. Itshould be understood that with reference to operations 6-7, the packet208 may either be an “exception” packet or a “non-exception” packet withrespect to the processing core 220. In either case, the firmware 215loaded on the processing core 210 is capable of processing the packet208. Of course, it should be understood that the firmware 215 may notalways be successful in processing each packet (e.g., if the packet ismalformed and/or corrupted).

Although FIG. 2 illustrates a multi-core packet processing architecturefor multi-core processor having two processing cores, this architecturemay be extended for any number of processing cores. For example, FIG. 3is a data flow diagram illustrating a multi-core packet processingarchitecture for a multi-core processor having two or more processingcores according to one embodiment of the invention. The multi-coreprocessor 300 includes the processing cores 310 and 320A-320N, and thepacket work assignment unit 305. According to one embodiment of theinvention, the packet work assignment unit 305 performs similarly to thepacket work assignment unit 205 as described with reference to FIG. 2.According to one embodiment of the invention, the multi-core processor300 is included within a network element.

The firmware 315 is loaded onto the processing core 310. According toone embodiment of the invention, the firmware 315 is similar to thefirmware 215 described in reference with FIG. 2 (e.g., the firmware is acomplete firmware image including operating system support). However, itshould be understood that in alternative embodiments of the inventionthe firmware 315 does not include a complete operating system and maynot include the functionality to process all ingress packets. Thefirmware 315 includes the processing type determination module 340, thenon-network packet processing module(s) 330, and the network packetprocessing module(s) 350. According to one embodiment of the invention,the processing type determination module 340, the non-network packetprocessing module(s) 330, and the network packet processing module(s)350 perform similarly as the processing type determination module 240,the non-network packet processing module(s) 230, and the network packetprocessing module(s) 250 as described with reference to FIG. 2.According to one embodiment of the invention, the non-network packetprocessing module(s) 330 and the network packet processing module(s) 350together define the types of packets the firmware 315 supportsprocessing. Packets belonging to the non-network packet processingmodule(s) 330 and/or the network packet processing module(s) 350 arepackets that may be processed by the non-network packet processingmodule(s) and/or the network packet processing module(s) 350.

The firmware 325A-325N is loaded onto the processing cores 320A-320Nrespectively. According to one embodiment of the invention, the firmware325A-325N are each similar to the firmware 225 as described withreference to FIG. 2 (e.g., the firmware 325A-325N each include a subsetof the features of the firmware 315). While in one embodiment of theinvention each of the firmware 325A-325N are the same firmware image, inan alternative embodiment of the invention at least some of the firmware325A-325N include a different firmware image while maintaining being asubset of the firmware 315 (e.g., the firmware 325A may include supportfor web traffic while the firmware 325B may include support for emailtraffic). The firmware 325A-325N includes the processing typedetermination modules 360A-360N respectively, and the subset networkpacket processing module(s) 370A-370N respectively. According to oneembodiment of the invention, the subset network packet processingmodule(s) 370A-370N define the types of packets the firmware 325A-325Nrespectively support processing. Packets belonging to the subset networkpacket processing module(s) 370A-370N are packets that may be processedby the subset network packet processing module(s) 370A-370Nrespectively. While in one embodiment of the invention the type(s) ofpackets belonging to the processing module(s) 370A-370N are the same(i.e., each of the processing module(s) 370A-370N support processing thesame type(s) of packets), in alternative embodiments of the inventionthe type(s) of packets belonging to the processing module(s) 370A-370Nmay be different between one or more of those processing module(s)370A-370N.

At operation 1, the packet 308 enters the packet work assignment unit305. For example, the packet 308 was received by an interface into thenetwork element and stored in memory and a reference to that packet wasplaced into an ingress queue associated with the packet work assignmentunit 305. Similarly as described with reference to the packet workassignment unit 205, the packet work assignment unit 305 may assign thepacket 308 to any of the processing cores of the multi-core processor300 (e.g., the processing core 310 or any of the processing cores320A-320N). In addition, in some embodiments the packet work assignmentunit 305 assigns the packet 308 to a processing core which supportsprocessing the packet 308. The operations 2-5 describe the operationsperformed when the packet work assignment unit 305 assigns the packet308 to be processed by the processing core 320N, the operations 6-9describe the operations performed when the packet work assignment unit305 assigns the packet 308 to be processed by the processing core 320A,and the operations 10-100 describe the operations performed when thepacket work assignment unit 305 assigns the packet 308 to be processedby the processing core 310.

At operation 2, the packet work assignment unit 305 assigns the packet308 to be processed by the processing core 320N. The packet workassignment unit 305 may assign the packet 308 with numerous mechanisms(e.g., as described with reference to FIG. 2). Sometime later atoperation 3, the packet 308 is processed by the subset network packetprocessing module(s) 370N upon the processing type determination module360N determining that the firmware 325N includes the functionality toprocess the packet 308. However, if the processing type determinationmodule 360N determines that the firmware 325N does not include thefunctionality to process the packet 308, at operation 4 the packet 308is redirected to the processing core 310 for processing. As describedwith reference to FIG. 2, the packet 308 may be redirected to theprocessing core 310 in any number of ways. Sometime later, at operation5, the packet 308 is processed by the firmware 315 loaded onto theprocessing core 310.

If the packet work assignment unit 305 determines to assign the packet308 to the processing core 320A, the following operations are performed.At operation 6, the packet work assignment unit 305 assigns the packet308 to be processed by the processing core 320A. Sometime later atoperation 7, the packet 308 is processed by the subset network packetprocessing module(s) 370A upon the processing type determination module360A determining that the firmware 325A includes the functionality toprocess the packet 308. However, if the processing type determinationmodule 360A determines that the firmware 325A does not include thefunctionality to process the packet 308, at operation 8 the packet 308is redirected to the processing core 310 for processing. As describedwith reference to FIG. 2, the packet 308 may be redirected to theprocessing core 310 in any number of ways. Sometime later, at operation9, the packet 308 is processed by the firmware 315 loaded onto theprocessing core 310.

At operation 10, the packet work assignment unit 305 assigns the packet308 to be processed by the processing core 310. Since the firmware 315includes a complete operating system capable of processing any ingresspacket, the processing type determination module 340 determines whichpacket processing module(s) are used to process packets of that type(e.g., whether the packet is a non-network packet (e.g., related toconfiguration management) or a network packet), and sometime later atoperation 11, that packet is processed with the appropriate packetprocessing module. It should be understood that with reference tooperations 10-11, the packet 308 may either be an “exception” packet ora “non-exception” packet in respect to the processing cores 320A-320N.In either case, the firmware 315 may process the packet 308. Of course,it should be understood that the firmware 315 may not always besuccessful in processing each packet (e.g., if the packet is malformedand/or corrupted). Thus, the multi-core packet processing architectureof the embodiments described herein may be implemented on a multi-coreprocessor having two or more processing cores.

FIG. 4 is a flow diagram illustrating operations of an exemplarymulti-core packet processing architecture according to one embodiment ofthe invention. At operation 410, a packet is received at a multi-coreprocessor (e.g., a multi-core processor of a secure router). Accordingto one embodiment of the invention, a first set of one or more of theprocessing cores of the multi-core processor is loaded with packetprocessing modules capable of processing any received packet, and asecond set of one or more of the processing cores of the multi-coreprocessor is loaded with a subset of the packet processing moduleswhich, while not capable of processing any received packet, may processmost received packets. Flow moves from block 410 to block 420. At block420, the packet is assigned to one of the processing cores of themulti-core processor, without taking into account the processingcapabilities loaded onto the processing cores (i.e., the packet may beassigned to any of the processing cores). Flow moves from block 420 toblock 430, where the packet is received at the assigned processing core.Flow moves from block 430 to block 440.

At block 440, the assigned processing core determines the processingrequired for the packet. Flow moves from block 440 to block 450. Atblock 450, a determination is made whether the assigned core supportsprocessing the received packet (e.g., whether the packet belongs to oneor more packet processing modules loaded on the assigned core). Theassigned processing core may not support processing the received packetfor a number of reasons (e.g., the assigned processing core does notinclude the appropriate packet processing module(s) to process thepacket, the assigned processing core is configured not to processpackets of that type, etc.). If the assigned processing core supportsprocessing the packet, then flow moves to block 460 where the packet isprocessed. However, if the assigned processing core does not supportprocessing the packet, then flow moves to block 470. At block 470, adetermination is made whether another processing core supportsprocessing the packet. If another processing core does not supportprocessing the packet, then flow moves to block 480 where the packet isdropped. If another processing core supports processing the packet, thenflow moves to block 490, where the packet is redirected to thatprocessing core. Flow then moves to block 495 where the packet is thenprocessed.

FIG. 5 is a conceptual flow diagram illustrating an exemplary processingphases of a packet being executed by a multi-core processor according toone embodiment of the invention. Packet processing may be split intomultiple packet processing stages, each being capable of being processedby a different processing core of a multi-core processor. FIG. 5illustrates five separate processing phases of a packet, however itshould be understood that the number and type of processing phases mayvary according to the type of packet received. Each processing phase isidentified with a phase identifier. According to one embodiment of theinvention, after completion of each phase, the phase identifier of thatphase is associated with the packet. According to one embodiment of theinvention, certain packet processing phases and/or certain packets ofthe same flow must be processed in order, and certain packet processingphases cannot be processed concurrently with other packet processingphases. According to one embodiment of the invention, transitioningbetween packet processing phases requires certain locks (e.g., asemaphore, a tag, etc.) to be obtained.

At block 510, the packet processing enters into an initial processingphase. As described previously, in some embodiments of the invention,the multi-core processor separates received packets into traffic flows.Typically, packets belonging to the same flow have the same source anddestination addresses. Separating packets into traffic flows assists inthe ordering and synchronizing of packets. In one embodiment of theinvention, the initial processing phase 510 includes assigning thepacket to a traffic flow based on properties of the packet (e.g., sourceIP address, destination IP address, source port, destination port,protocol, etc.). In addition to separating packets into traffic flows,in some embodiments of the invention the initial processing phase 510includes assigning a tag type and value to the packet which determinesthe order in which the packet is processed (order as compared to otherpackets of the same traffic flow) and whether multiple packets with thesame tag type and value may be processed concurrently. At the conclusionof the initial processing phase, a phase identifier indicating that theprocessing stage has been completed is stored. Flow moves from block 510to block 520.

At block 520, the packet enters into a packet flow lookup phase, wherethe packet flow list is accessed. At the conclusion of the packet flowlookup phase, a phase identifier indicating that the processing stagehas been completed is stored. Flow moves from block 520 to block 530. Atblock 530, the packet enters into the packet flow processing phase.According to one embodiment of the invention, only a single processingcore may have access to the packet flow (for a given flow) at a giventime. Thus, a lock on that flow must be obtained. In order to preventhead of the line blocking, according to some embodiments of theinvention, a processing core that encounters a lock for a given packetde-schedules that packet (e.g., returns that packet back to the ingressqueue) and receives another packet to process. Since a processing phaseidentifier is associated with that packet, the packet may be resumed atthat specific processing phase as soon as the lock is removed. At theconclusion of the packet flow processing phrase, a phase identifierindicating that the processing phase has been completed is stored. Flowmoves from block 530 to block 540.

At block 540, the packet enters into a security association processingphase. It should be understood that not every packet will enter into asecurity association processing phase. The security associationprocessing phase will be skipped if the packet does not require securityassociation processing. At the conclusion of the security associationprocessing phase, a phase identifier indicating that the processingphase has been completed is stored. Flow moves from block 540 to block550. At block 550, the packet enters into an output processing phase.

FIG. 6 is a data flow diagram illustrating scheduling and de-schedulingpacket processing to cores of a multi-core processor according to oneembodiment of the invention. According to one embodiment of theinvention, packets are processed according to the multi-core packetprocessing architecture described in reference to FIG. 3. However,aspects of the invention are not so limited, as alternative packetprocessing architectures may be used in embodiments of the inventiondescribed with reference to FIG. 6.

The packet work assignment unit 305 includes the input queue 620 and thede-schedule queue 630. The input queue 620 stores packets to beprocessed and to be assigned to a processing core, while the de-schedulequeue 620 stores packets which have been assigned and de-scheduled,which will be described in greater detail later herein. While in oneembodiment of the invention the input queue 620 and the de-schedulequeue 630 are implemented as a FIFO (first-in-first-out) queue, inalternative embodiments of the invention the input queue 620 and thede-schedule queue 630 is implemented differently. The packets 610A-610B,612, and 614 are stored in the input queue 620. According to oneembodiment of the invention, the packets 610A-610B are associated withthe same flow (e.g., they have the same source and destination). Inaddition, for the following discussion, at least certain processingphases of the packet 610B cannot be processed until certain processingphases of the packet 610A have completed processing (i.e., certainpacket processing phases must be completed in order).

At operation 1, the packet work assignment unit 305 assigns the packet610A to be processed by the processing core 310 (illustrated by thepacket 610A being inside a dashed box within the processing core 310).With reference to FIG. 6, at operation 2 the processing core 310A beginsprocessing the packet 610A. As part of the processing of the packet610A, the processing core 310 enters a processing phase which requires alock to be placed on other packets of that traffic flow (at least to theextent of at least one processing phase) until the processing phase hasbeen completed. Since the packet 610B belongs to the same traffic flowas the packet 610A, at least some of the packet processing phases of thepacket 610B needs to be performed after at least some of the processingphases of the packet 610A have been completed.

At operation 3, the packet work assignment unit 305 assigns the packet610B to the processing core 320A (represented by the packet 610B insidea dashed box within the processing core 320A). According to oneembodiment of the invention, the packet 610B is assigned to theprocessing core 320A prior to the processing core 310 releasing thelock. The processing core 320A processes the packet 610B until itreaches the processing phase when it encounters the lock. As describedwith reference to FIG. 5, at the end of each processing phase, aprocessing phase identifier is associated with the packet. Since atleast some of the processing phases of the packet 610B cannot beprocessed while a lock is obtained on the flow, at operation 4, theprocessing core 320A de-schedules the packet 610B (e.g., return thepacket 610B to the packet work assignment unit 305) once it encountersthe lock, with the intention that the processing core 320A will beassigned a different packet to process. It should be understood that ifthe processing core 320A does not de-schedule the packet 610B, theprocessing core 320A will remain idle until the lock has been released.Thus, at operation 4, the processing core 320A encounters the lock andde-schedules the packet 610B. According to one embodiment of theinvention, the packet 610B is returned back to the packet workassignment unit 305 and stored in the de-schedule queue 630. Dependingon when the lock was encountered, the packet 610B may be partiallyprocessed when it is de-scheduled. It should be understood that anyprocessing phase identifier associated with the packet remainsassociated with the packet. Thus, the processing of the packet 610B maybe resumed at the particular processing phase it was at when the lockwas encountered. At operation 5, the packet work assignment unit 305assigns the packet 612 to the processing core 320A (represented with thepacket 612 inside a dashed box within the processing core 320A). Thereis no lock preventing the processing of the packet 612, thus atoperation 6, the processing core 320A processes the packet 612. Atoperation 7, the processing core 310A finishes processing at least theprocessing phase of the packet 610A requiring the lock and thus removesthe lock.

According to one embodiment of the invention, the packet work assignmentunit 305 gives priority to scheduling packets in the de-schedule queue630. For example, packets in the de-schedule queue 630 are scheduledprior to scheduling packets in the ingress queue 620. Thus, at operation8, the packet work assignment unit 305 assigns the processing core 320Nto process the packet 610B from the de-schedule queue 630. At operation9, the processing core 320N processes the packet 610B. According to oneembodiment of the invention, the processing core 320N resumes processingof the packet 610B at the particular processing phase that encounteredthe lock (e.g., by determining the appropriate processing phase byreading the processing phase identifier associated with the packet610B).

At operation 10, the packet work assignment unit 305 assigns the packet614 to the processing core 310 (represented by the packet 614illustrated in a dashed box within the processing core 310). Atoperation 11, the processing core 310 processes the packet 614.

FIG. 7 is a flow diagram illustrating operations for de-schedulingpacket processing to prevent head of the line blocking according to oneembodiment of the invention. According to one embodiment of theinvention, a processing core (e.g., one of the processing cores 310 or320A-320N) performs the operations illustrated in FIG. 7.

At block 710, a processing core receives the scheduling of packetprocessing work from the packet work assignment unit. Flow moves fromblock 710 to block 720. At block 720, a determination is made whetherthe packet processing work is associated with a particular processingphase. For example, the processing core determines whether a processingphase identifier is associated with the packet. If there is no packetprocessing phase associated with the packet, flow moves to block 724where processing begins. If there is a packet processing phaseassociated with the packet, flow moves to block 728 where processingbegins at that processing phase. Flow moves from block 724 and 728 toblock 730.

At block 730, a determination is made whether the processing is stalledby a lock. If the processing is not stalled by a lock, then flow movesto block 760 where the packet work is processed. However, if theprocessing is stalled by a lock, then flow moves to block 740 where thepacket is de-scheduled (e.g., returned to the packet work assignmentunit). Flow moves from block 740 to block 750. At block 750, theprocessing core receives scheduling of packet work of a different packetfrom the packet work assignment unit, and flow moves back to block 720.

While FIG. 3 illustrated a multi-core processing architecture having oneof the processing cores (e.g., the processing core 310) including acomplete firmware, it should be understood that in some embodiments ofthe invention a plurality of processing cores may include a completefirmware.

While embodiments of the invention have described a multi-coreprocessing architecture having one or more of the processing coresincluding a complete firmware, it should be understood that in someembodiments of the invention a set of two or more processing cores maycollectively include the functionality of a complete firmware. Forexample, in one embodiment of the invention, each processing core of thecollective complete firmware set may include the capability ofprocessing at least certain data packets, and one or more processingcores of the set may include the capability of processing configurationpackets while different one or more processing cores may include thecapability of processing control packets.

It should be understood that the types of packets described herein(e.g., control packets, data packets, configuration packets) areexemplary, additional and/or alternative types of packets may be used inembodiments of the invention described herein.

While the flow and data flow diagrams in the figures show a particularorder of operations performed by certain embodiments of the invention,it should be understood that such order is exemplary (e.g., alternativeembodiments may perform the operations in a different order, combinecertain operations, overlap certain operations, etc.)

While the invention has been described in terms of several embodiments,those skilled in the art will recognize that the invention is notlimited to the embodiments described, can be practiced with modificationand alteration within the spirit and scope of the appended claims. Thedescription is thus to be regarded as illustrative instead of limiting.

What is claimed is:
 1. A method for processing packets, the methodcomprising: receiving a first packet sent over a communication network;identifying that at least one processing phase of the first packetcorresponds to a control packet type, wherein the at least oneprocessing phase of the first packet is processed at a first processorbased on the identification that the at least one processing phase ofthe first packet corresponds to the control packet type; receiving asecond packet sent over the communication network; and identifying thatat least one processing phase of the second packet does not correspondto the control packet type, wherein the at least one processing phase ofthe second packet is processed at a second processor that does notinclude support for processing the control packet type.
 2. The method ofclaim 1, wherein the first packet was initially received at the secondprocessor and further comprising the second processor: identifying thatthe first packet being a control type packet, wherein the secondprocessor does not include the support for processing the control typepacket; and passing the packet to the first processor based on the firstprocessor having a capability of processing the control type packet. 3.The method of claim 1, wherein the first packet was initially receivedat the first processor, and wherein the first processor processes the atleast first processing phase of the first packet further based on thefirst processor having a capability for processing the at least oneprocessing phase of the first packet.
 4. The method of claim 1, whereinthe first processor is able to process a greater number of types ofingress packet types than the second processor.
 5. The method of claim1, wherein the first packet is initially received by a work assignmentunit, and further comprising assigning the first packet to the firstprocessor based on the first processor having a capability of processingat least the first processing phase of the first packet.
 6. The methodof claim 1, further comprising: identifying that one or more packets arecurrently stored in a de-schedule queue; prioritizing the processing ofat least one of the packets currently stored in the de-schedule queueover another packet that is stored in an ingress queue; and processingat least a portion of the at least one packet currently stored in thede-schedule queue based on the prioritization.
 7. The method of claim 1,wherein the at least one processing phase of the second packet isprocessed at the second processor, and further comprising storing thesecond packet in a queue after the at least one processing phase of thesecond packet is processed based on a processing lock on at least asecond processing phase of the second packet.
 8. A non-transitorycomputer-readable storage medium having embodied thereon a programexecutable for performing a method for processing packets, the methodcomprising: receiving a first packet; identifying that at least oneprocessing phase of the first packet corresponds to a control packettype, wherein the at least one processing phase of the first packet isprocessed at a first processor based on the identification that the atleast one processing phase of the first packet corresponds to thecontrol packet type; receiving a second packet; and identifying that atleast one processing phase of the second packet does not correspond tothe control packet type, wherein the at least one processing phase ofthe second packet is processed at a second processor that does notinclude support for processing the control packet type.
 9. Thenon-transitory computer-readable storage medium of claim 8, wherein thefirst packet was initially received at the second processor, and furthercomprising instructions executable by the second processor to: identifythat the first packet being a control type packet, wherein the secondprocessor not including the support for processing the control typepacket; and pass the packet to the first processor based on the firstprocessor having a capability of processing the control type packet. 10.The non-transitory computer-readable storage medium of claim 8, whereinthe first packet was initially received at the first processor, and thefirst processor processes the at least first processing phase of thefirst packet further based on the first processor having a capabilityfor processing the at least one processing phase of the first packet.11. The non-transitory computer-readable storage medium of claim 8,wherein the first processor is able to process a greater number of typesof ingress packet types than the second processor.
 12. Thenon-transitory computer-readable storage medium of claim 8, wherein thefirst packet is initially received by a work assignment unit, andfurther comprising instructions executable by the work assignment unitto assign the first packet to the first processor based on the firstprocessor having a capability of processing at least the firstprocessing phase of the first packet.
 13. The non-transitorycomputer-readable storage medium of claim 8, further comprisinginstructions executable to: identify that one or more packets arecurrently stored in a de-schedule queue; prioritize the processing of atleast one of the packets currently stored in the de-schedule queue overanother packet that is stored in an ingress queue; and process at leasta portion of the at least one packet currently stored in the de-schedulequeue based on the prioritization.
 14. The non-transitorycomputer-readable storage medium of claim 8, wherein the at least oneprocessing phase of the second packet is processed at the secondprocessor, and further comprising instructions executable to provide thesecond packet for storage in a queue after the at least one processingphase of the second packet is processed based on a processing lock on atleast a second processing phase of the second packet.
 15. A system forprocessing packets, the system comprising: a network interface thatreceives a first packet and a second packet sent over a communicationnetwork, wherein the first packet corresponds to a control packet type,and wherein the second packet does not correspond to the control packettype; a first processor that processes at least one processing phase ofthe first packet based on an identification that the at least oneprocessing phase of the first packet corresponds to the control packettype; and a second processor that processes at least one processingphase of the second packet, wherein the second processor does notinclude support for processing the control packet type.
 16. The systemof claim 15, wherein the first packet was initially received at thesecond processor, and wherein the second processor: identifies that thefirst packet being a control type packet, wherein the second processornot including the support for processing the control type packet; andpasses the packet to the first processor based on the first processorhaving a capability of processing the control type packet.
 17. Theapparatus of claim 15, wherein the first processor initially receivesthe first packet, and wherein the first processor processes the at leastfirst processing phase of the first packet further based on the firstprocessor having a capability for processing the at least one processingphase of the first packet.
 18. The system of claim 15, wherein the firstprocessor is able to process a greater number of types of ingress packettypes than the second processor.
 19. The system of claim 15, furthercomprising a work assignment unit that initially receives the firstpacket and assigns the first packet to the first processor based on thefirst processor having a capability of processing at least the firstprocessing phase of the first packet.
 20. The system of claim 15,further comprising a de-schedule queue in buffer memory that stores oneor more packets, wherein the processing of at least one packet of theone or more packets currently stored in the de-schedule queue isprioritized over a packet stored in an ingress queue, and wherein atleast a portion of the at least one packet of the one or more packetscurrently stored in the de-schedule queue is processed based on theprioritization.